package com.jxw.launcher.view;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.RadioButton;

/* loaded from: classes.dex */
public class MenuViewItem extends RadioButton {
    private Bitmap bitmap;
    private int height;
    private int width;

    public MenuViewItem(Context context) {
        super(context);
        this.width = -1;
        this.height = -1;
    }

    public MenuViewItem(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.width = -1;
        this.height = -1;
    }

    public MenuViewItem(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.width = -1;
        this.height = -1;
    }

    @Override // android.widget.TextView, android.view.View
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() != 0) {
            return super.onTouchEvent(motionEvent);
        }
        int x = (int) motionEvent.getX();
        int y = (int) motionEvent.getY();
        if (this.width == -1 || this.height == -1) {
            this.bitmap = ((BitmapDrawable) ((StateListDrawable) getBackground()).getCurrent()).getBitmap();
            this.width = getWidth();
            this.height = getHeight();
        }
        Bitmap bitmap = this.bitmap;
        if (bitmap == null || x < 0 || y < 0 || x >= this.width || y >= this.height || bitmap.getPixel(x, y) == 0) {
            return false;
        }
        return super.onTouchEvent(motionEvent);
    }
}
